<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:body>
    	<ui:composition template="./templates/framework.xhtml">
			<ui:define name="content">
				<ui:include src="./templates/header.xhtml">
					<ui:param name="text" value="#{i18n['generic.back']}" />
					<ui:param name="link" value="index.xhtml" />
				</ui:include>
				<h:form enctype="multipart/form-data" id="importForm" styleClass="primary">
					<h:inputHidden id="encryptionPassword" value="#{importBean.encryptionPassword}" />
					<div>
						<h:outputLabel for="file" value="#{i18n['import.file']}" />
						<t:inputFileUpload id="file" value="#{importBean.file}" required="true" requiredMessage="#{i18n['import.fileRequired']}" />
						<span class="error"><h:message for="file" /></span>
					</div>
					<div>
						<h:outputLabel for="fileFormat" value="#{i18n['export.fileFormat']}" />
						<h:selectOneMenu id="fileFormat" value="#{importBean.fileFormat}">
							<f:selectItem itemLabel="KeePass Database v1 (.kdb)" itemValue="kdb" />
						</h:selectOneMenu>
						<span class="error"><h:message for="fileFormat" /></span>
					</div>
					<div>
						<h:outputLabel for="password" value="#{i18n['import.filePassword']}" />
						<h:inputSecret id="password" value="#{importBean.password}" autocomplete="off" redisplay="true" />
						<span class="error"><h:message for="password" /></span>
					</div>
					<div>
						<h:selectBooleanCheckbox id="importGroups" value="#{importBean.importGroups}" />
						<h:outputLabel for="importGroups" value="#{i18n['import.importGroups']}" styleClass="checkboxLabel" />
						<span class="error"><h:message for="importGroups" /></span>
					</div>
					<div>
						<h:selectBooleanCheckbox id="maintainGroups" value="#{importBean.maintainGroups}" />
						<h:outputLabel for="maintainGroups" value="#{i18n['import.maintainGroups']}" styleClass="checkboxLabel" />
						<span class="error"><h:message for="maintainGroups" /></span>
					</div>
					<div class="warn">
						<h:outputText value="#{i18n['import.warning']}" />
					</div>
					<div class="buttons">
						<h:commandButton type="submit" value="#{i18n['import.import']}" action="#{importBean.process}" />
						<input type="button" value="#{i18n['generic.cancel']}" onclick="location.href='index.xhtml'" />
					</div>
				</h:form>
			</ui:define>
		</ui:composition>
    </h:body>
</html>